﻿using System;
using System.Windows;
using System.Windows.Controls;

namespace Gmantis.Controls
{
    public sealed class LayoutRounder : ContentPresenter
    {
        protected override Size MeasureOverride(Size constraint)
        {
            Size size = base.MeasureOverride(constraint);
            size.Width = Math.Min(constraint.Width, Math.Ceiling(size.Width));
            size.Height = Math.Min(constraint.Height, Math.Ceiling(size.Height));
            return size;
        }
    }
}
